package decorator.decorator;

import decorator.component.Drink;

/**
 * 抽象装饰器：配料抽象类
 *
 * @author Liu Yicong
 * @date 2025/9/21
 */
public abstract class DrinkDecorator implements Drink {
	// 关键：持有对被装饰对象的引用 (即 Coffee 或另一个 CoffeeDecorator)
	protected final Drink decoratedDrink;

	public DrinkDecorator(Drink drink) {
		this.decoratedDrink = drink;
	}

	// 默认实现委托给被装饰对象，子类可以重写并添加自身的功能
	@Override
	public String getDescription() {
		return decoratedDrink.getDescription();
	}

	@Override
	public double getCost() {
		return decoratedDrink.getCost();
	}
}
